import { defineStore } from "pinia";
import { getUserProfile } from "@/api/user.js";
export const useUserStore = defineStore({
  id: "user",
  state: () => ({
    info: undefined,
    userId: "",
    phoneId: "",
  }),
  getters: {
    userInfo: (state) => state.info,
  },
  actions: {
    async getUserInfo(params) {
      const res = await getUserProfile();
     this.setUserInfo(res.data)
      this.userId = res.data.userId;
    },
    setPhoneId(id) {
      this.phoneId = id;
    },
    setUserInfo(data) {
      this.info = data;
    },
  },
});
